home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
gfx
/
misc
/
gnuplot-3.7src.lha
/
gnuplot-3.7src
/
gnuplot-3.7.lha
/
gnuplot-3.7
/
term
/
debug.trm
< prev
next >
Wrap
Text File
|
1998-11-26
|
8KB
|
314 lines
/*
* $Id: debug.trm,v 1.11 1998/04/14 00:17:35 drd Exp $
*
*/
/* GNUPLOT - debug.trm */
/*[
* Copyright 1990 - 1993, 1998 Thomas Williams, Colin Kelley
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* This file is included by ../term.c.
*
* This terminal driver supports:
* DEBUG
*
* AUTHORS
* luecken@udel.edu
*
* send your comments or suggestions to (luecken@udel.edu).
*
*/
/*
* adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
* generalised to have *all* defined capabilities by HBB (June 1997)
*/
#include "driver.h"
#ifdef TERM_REGISTER
register_term(debug)
#endif
#ifdef TERM_PROTO
TERM_PUBLIC void DEBUG_init __PROTO((void));
TERM_PUBLIC void DEBUG_graphics __PROTO((void));
TERM_PUBLIC void DEBUG_text __PROTO((void));
TERM_PUBLIC void DEBUG_linetype __PROTO((int linetype));
TERM_PUBLIC void DEBUG_move __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void DEBUG_vector __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void DEBUG_put_text __PROTO((unsigned int x, unsigned int y, char *str));
TERM_PUBLIC void DEBUG_reset __PROTO((void));
TERM_PUBLIC int DEBUG_justify_text __PROTO((enum JUSTIFY mode));
TERM_PUBLIC int DEBUG_text_angle __PROTO((int ang));
TERM_PUBLIC void DEBUG_point __PROTO((unsigned int x, unsigned int y, int pointstyle));
TERM_PUBLIC void DEBUG_arrow __PROTO((unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head));
TERM_PUBLIC int DEBUG_set_font __PROTO((char *font));
TERM_PUBLIC void DEBUG_pointsize __PROTO((double pointsize));
TERM_PUBLIC void DEBUG_suspend __PROTO((void));
TERM_PUBLIC void DEBUG_resume __PROTO((void));
TERM_PUBLIC void DEBUG_fillbox __PROTO((int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height));
TERM_PUBLIC void DEBUG_linewidth __PROTO((double linewidth));
#define DEBUG_XMAX 512
#define DEBUG_YMAX 390
#define DEBUG_XLAST (DEBUG_XMAX - 1)
#define DEBUG_YLAST (DEBUG_XMAX - 1)
/* Assume a character size of 1, or a 7 x 10 grid. */
#define DEBUG_VCHAR 10
#define DEBUG_HCHAR 7
#define DEBUG_VTIC (DEBUG_YMAX/70)
#define DEBUG_HTIC (DEBUG_XMAX/75)
#endif /* TERM_PROTO */
#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
int DEBUG_linetype_last;
int DEBUG_xlast;
int DEBUG_ylast;
TERM_PUBLIC void DEBUG_init()
{
fputs("init\n", gpoutfile);
DEBUG_linetype_last = -3;
}
TERM_PUBLIC void DEBUG_graphics()
{
DEBUG_xlast = DEBUG_ylast = 0;
fputs("graphics\n", gpoutfile);
}
TERM_PUBLIC void DEBUG_text()
{
fputs("text\n", gpoutfile);
}
TERM_PUBLIC void DEBUG_linetype(linetype)
int linetype;
{
/*
if (linetype != DEBUG_linetype_last){
fprintf(gpoutfile,"l%d",linetype);
DEBUG_linetype_last = linetype;
}
*/
fprintf(gpoutfile, "line %d\n", linetype);
}
TERM_PUBLIC void DEBUG_move(x, y)
unsigned int x, y;
{
/*
if (x != DEBUG_xlast || y != DEBUG_ylast){
fprintf(gpoutfile,"mm");
DEBUG_xlast = x;
DEBUG_ylast = y;
}
*/
fprintf(gpoutfile, "move %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
DEBUG_xlast = x;
DEBUG_ylast = y;
}
TERM_PUBLIC void DEBUG_vector(x, y)
unsigned int x, y;
{
/*
if (x != DEBUG_xlast || y != DEBUG_ylast){
fprintf(gpoutfile,"vv");
DEBUG_xlast = x;
DEBUG_ylast = y;
}
*/
fprintf(gpoutfile, "vect %d, %d\t(%d, %d)\n", x, y, x - DEBUG_xlast, y - DEBUG_ylast);
DEBUG_xlast = x;
DEBUG_ylast = y;
}
TERM_PUBLIC void DEBUG_put_text(x, y, str)
unsigned int x, y;
char *str;
{
/*
DEBUG_move(x,y);
fprintf(gpoutfile,"tx%s\r",str);
*/
fputs("put_text calls:", gpoutfile);
DEBUG_move(x, y);
fprintf(gpoutfile, "put_text '%s'\n", str);
}
TERM_PUBLIC void DEBUG_reset()
{
fputs("reset", gpoutfile);
}
TERM_PUBLIC int DEBUG_justify_text(mode)
enum JUSTIFY mode;
{
fputs("justify ", gpoutfile);
switch (mode) {
case (CENTRE):
fputs("centre", gpoutfile);
break;
case (RIGHT):
fputs("right", gpoutfile);
break;
default:
case (LEFT):
fputs("left", gpoutfile);
break;
}
fputs("\n", gpoutfile);
return (TRUE);
}
TERM_PUBLIC int DEBUG_text_angle(ang)
int ang;
{
fprintf(gpoutfile, "text_angle %d:", ang);
switch (ang) {
case 0:
fputs(": horizontal\n", gpoutfile);
break;
case 1:
fputs(": upwards\n", gpoutfile);
break;
default:
fputs(": \a*undefined*\n", gpoutfile);
break;
}
return TRUE;
}
TERM_PUBLIC void DEBUG_point(x, y, pointstyle)
unsigned int x, y;
int pointstyle;
{
fprintf(gpoutfile, "point at (%ud,%ud), pointstyle %d\n", x, y, pointstyle);
}
TERM_PUBLIC void DEBUG_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
int head;
{
fprintf(gpoutfile, "arrow from (%ud,%ud) to (%ud,%ud), %s head\n",
sx, sy, ex, ey, head ? "with" : "without");
}
TERM_PUBLIC int DEBUG_set_font(font)
char *font;
{
fprintf(gpoutfile, "set font to \"%s\"\n",
font ? (*font ? font : "\aempty string!") : "\aNULL string!");
return TRUE;
}
TERM_PUBLIC void DEBUG_pointsize(pointsize)
double pointsize;
{
fprintf(gpoutfile, "set pointsize to %lf\n", pointsize);
}
TERM_PUBLIC void DEBUG_suspend(void)
{
fputs("suspended terminal driver\n", gpoutfile);
}
TERM_PUBLIC void DEBUG_resume(void)
{
fputs("resumed terminal driver\n", gpoutfile);
}
TERM_PUBLIC void DEBUG_fillbox(style, x1, y1, width, height)
int style;
unsigned int x1, y1, width, height;
{
fprintf(gpoutfile, "fillbox/clear at (%ud,%ud), area (%ud,%ud), style %d)\n",
x1, y1, width, height, style);
}
TERM_PUBLIC void DEBUG_linewidth(double linewidth)
{
fprintf(gpoutfile, "set linewidth %lf\n", linewidth);
}
#endif /* TERM_BODY */
#ifdef TERM_TABLE
TERM_TABLE_START(debug_driver)
"debug", "debugging driver",
DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
DEBUG_linetype, DEBUG_put_text, DEBUG_text_angle,
DEBUG_justify_text, DEBUG_point, DEBUG_arrow, DEBUG_set_font,
DEBUG_pointsize,
TERM_CAN_MULTIPLOT,
DEBUG_suspend, DEBUG_resume, DEBUG_fillbox, DEBUG_linewidth
TERM_TABLE_END(debug_driver)
#undef LAST_TERM
#define LAST_TERM debug_driver
#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */
#ifdef TERM_HELP
START_HELP(debug)
"1 debug",
"?commands set terminal debug",
"?set terminal debug",
"?set term debug",
"?terminal debug",
"?term debug",
"?debug",
" This terminal is provided to allow for the debugging of `gnuplot`. It is",
" likely to be of use only for users who are modifying the source code."
END_HELP(debug)
#endif